home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine PD Edition 0
/
Amoszine PD Edition 0.adf
/
SOURCE_CODE
/
AJC-POLY.AMOS
/
AJC-POLY.amosSourceCode
Wrap
AMOS Source Code
|
1993-02-25
|
2KB
|
86 lines
'
' "Poly" By Andrew Campbell
'
' Enter a value (eg: 7) then drag the mouse to the <---- LEFT
' whilst holding the LEFT BUTTON to make a linked
' polygon. The RIGHT button will return to the input.
'
' This program was written to help my brother who took
' GCSE Maths. Perhaps it might assist someone else...?
'
' Try a value of 20 and make a BIG polygon!
'
Dim XPOINTS(150),YPOINTS(150)
Global R,NP,FINISHED,TMS
Screen Open 0,320,256,16,Lowres
Curs Off : Flash Off : Paper 0 : Cls 0
Ink 2,6
HEAVEN:
Cls 0
ANG=0 : Input "Enter number of sides... ";NP
Cls 0
Global XPOINTS(),YPOINTS()
_LOOP:
Repeat
X=X Screen(X Mouse) : Y=Y Screen(Y Mouse)
If Mouse Key=2 : Goto HEAVEN : End If
Until Mouse Key=1
While Mouse Key=1
X2=X Screen(X Mouse) : Y2=Y Screen(Y Mouse)
Gr Writing 2
R=(X-X2)/2
If R<1 : R=1 : End If
_POLYGON[X,Y,NP,R,R,ANG,1]
_POLYGON[X,Y,NP,R,R,ANG,1]
Wend
Gr Writing 0
FINISHED=1
_POLYGON[X,Y,NP,R,R,ANG,1]
For J=1 To NP
For I=1 To NP
Draw XPOINTS(J),YPOINTS(J) To XPOINTS(I),YPOINTS(I)
Next I
Next J
Goto _LOOP
Procedure _POLYGON[_XCOOR,_YCOOR,_POINTS,_XSIZE,_YSIZE,_ANGLE,_FILLED]
Degree
If _POINTS<3
_POINTS=3
End If
If _POINTS>360
_POINTS=360
End If
TMS=0
For N=0+_ANGLE To 359+_ANGLE Step 360/_POINTS
Inc TMS
X1=_XCOOR+Cos(N)*R
Y1=_YCOOR+Sin(N)*R
X2=_XCOOR+Cos(N+360/_POINTS)*R
Y2=_YCOOR+Sin(N+360/_POINTS)*R
If FINISHED=1
XPOINTS(TMS)=X2
YPOINTS(TMS)=Y2
End If
Polyline X1,Y1 To X2,Y2
Next N
End Proc